<template>
    <view>
        <uni-pop-class ref="popupShare" type="bottom" @change="change">
            <pop-item @imageready="sendImage"></pop-item>
        </uni-pop-class>
    </view>
</template>

<script>
import uniPopClass from '@/components/third_party/uni-pop/uni-pop-class.vue';
import PopItem from './pop-item.vue';
export default {
    components: {
        uniPopClass,
        PopItem
    },
    props: {
        show: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            type: 'bottom',
            msgType: 'success',
            message: '这是一条成功消息提示',
            value: '默认输入的内容'
        };
    },
    watch: {
        /**
         * 监听对话框是否显示
         */
        show: {
            handler: function(newVal) {
                if(newVal && newVal == true)
                    this.$refs.popupShare.open();
            }
        },
    },
    methods: {
        /**
         * 选择内容
         */
        sendImage(e) {
            this.$emit('imageready', e);
        },
        /**
         * popup 状态发生变化触发
         * @param {Object} e
         */
        change(e) {
            //console.log('popup ' + e.type + ' 状态', e.show);
            this.$emit('closeme', {show: e.show});//this.show=e.show
        },
    },
    /**
     * 拦截应用返回事件，仅仅 app 端生效
     */
    onBackPress() {

    }
};
</script>
<style scoped>
    /* 头条小程序组件内不能引入字体 */
    /* #ifdef MP-TOUTIAO */
    @font-face {
        font-family: uniicons;
        font-weight: normal;
        font-style: normal;
        src: url('~@/static/uni.ttf') format('truetype');
    }

    /* #endif */

    /* #ifndef APP-NVUE */
    page {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        background-color: #efeff4;
        min-height: 100%;
        height: auto;
    }

    view {
        font-size: 14px;
        line-height: inherit;
    }
    /* #endif */
</style>
